//
//  HTSingerCell.m
//  HeartTravel
//
//  Created by lanou on 15/10/29.
//  Copyright © 2015年 陈文杰. All rights reserved.
//

#import "HTSingerCell.h"

@implementation HTSingerCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
//        UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
//        imageView.backgroundColor = [UIColor clearColor];
//        imageView.alpha = 0.2;
        _singerImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
        _singerImg.layer.cornerRadius = 20;
        _singerImg.layer.masksToBounds = YES;
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(60, 15, SCREEN_WIDTH - 60, 30)];
        _nameLabel.textColor = [UIColor whiteColor];
//        [self.contentView addSubview:imageView];
        
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 60)];
        //        view.backgroundColor = [UIColor whiteColor];
        
        CAGradientLayer *gradientLayer = [CAGradientLayer layer];  // 设置渐变效果
        gradientLayer.bounds = view.bounds;
        gradientLayer.borderWidth = 0;
        
        gradientLayer.frame = view.bounds;
        gradientLayer.colors = [NSArray arrayWithObjects:
                                (id)[[UIColor colorWithRed:0.266 green:0.994 blue:1.000 alpha:0.950] CGColor],
                                (id)[[UIColor clearColor]CGColor], nil];
        gradientLayer.startPoint = CGPointMake(0, 0);
        gradientLayer.endPoint = CGPointMake(1.0, 1.0);
        
        [view.layer insertSublayer:gradientLayer atIndex:0];
        
        [view addSubview:_singerImg];
        [view addSubview:_nameLabel];
        [self.contentView addSubview:view];
    }
    return self;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
